package com.talkweb.historylib.provider;

import com.talkweb.historylib.ResourceTable;
import com.talkweb.securitycamera.common.interfaces.entity.IBaseFileEntity;
import ohos.aafwk.ability.Ability;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.DirectionalLayoutManager;
import ohos.agp.components.ListContainer;

import java.util.List;

/**
 * @author SUQI
 * @date 2021/2/3
 * @description 图片网格列表适配器
 **/
public class ImageListProvider extends BaseListProvider<List<IBaseFileEntity>> {
    public ImageListProvider(Ability mContext) {
        super(mContext);
    }

    @Override
    protected void onBindViewHolder(ViewHolder viewHolder, List<IBaseFileEntity> data, int position) {
        ListContainer itemListContainer = viewHolder.getView(ResourceTable.Id_item_lc_list);
        DirectionalLayoutManager layoutManager = new DirectionalLayoutManager();
        layoutManager.setOrientation(DirectionalLayout.HORIZONTAL);
        itemListContainer.setLayoutManager(layoutManager);
        //设置item
        ImageItemProvider imageItemProvider = new ImageItemProvider(getAbilityContext(), position);
        itemListContainer.setItemProvider(imageItemProvider);
        imageItemProvider.setDataList(data);
    }

    @Override
    protected int getLayoutId() {
        return ResourceTable.Layout_item_view_image_list;
    }

}
